﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using NENAData.NENAMember;

namespace Events.Register
{
    public partial class Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

                                
        if (Session["Message"] == "")
            {
            lblMessage.Text = Session["Message"].ToString();
            Session["Message"] = "";
            }        
            
        if (User.Identity.Name == null) 
            {
            Session.Abandon();
            Response.Redirect("http://membership.nena.ca/", false);
            }

            
        NENAMember oNenaData = new NENAMember();
        var oMember = oNenaData.GetMember_byCsUserName(User.Identity.Name);

        Session["Member_ID"] = oMember.Member_ID;
        Session["FullName"] = oMember.FirstName + " " + oMember.LastName;
        lblFullName.Text = Session["FullName"].ToString();
        Response.Write("NENA MemberID :" + Session["Member_ID"].ToString());


        if (oMember.Paid == "Y")
        {
            lblMessage.Text = "You are a current NENA member, you will recieve membership pricing if available.";
            Session["PaidMember"] = "True";
        }
        else
        {
            lblMessage.Text = @"You are not a current NENA member, you will recieve non-membership pricing. <br />
                                Please visit our <a target='_blank' href='http://membership.nena.ca'>membership website here</a> if you wish to renew your membership.";
            Session["PaidMember"] = "False";
        }            
        }
    }
}